package com.smh.demo1.a07;

import com.smh.demo1.common.LogColour;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shiminghui
 * @date 2025/4/12 11:16
 * @description: TODO
 */
@Configuration
public class Config {

    /*
     * 执行次序,注解最快,Aware接口次之,其他接口次之,@bean的回调最慢
     * */

    @Bean(initMethod = "init")
    public Bean1 bean1() {
        System.out.println(LogColour.Green("Config.bean1()"));
        return new Bean1();
    }

    @Bean(destroyMethod = "destroy2")
    public Bean2 bean2() {
        System.out.println(LogColour.Green("Config.bean2()"));
        return new Bean2();
    }
}
